﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="ASSA Rendiciones" %>



<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["Id"].Equals("new"))
        {
            FormView1.DefaultMode = FormViewMode.Insert;
        }
        else
        {
            if (!Request.QueryString["Id"].Equals(""))
            {
                SqlDataSource1.SelectParameters["IdRendicion"].DefaultValue = Request.QueryString["Id"];
                FormView1.DefaultMode = FormViewMode.Edit;
            }
            else
            {
                FormView1.DefaultMode = FormViewMode.ReadOnly;
            }
        }
    }
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="Contenedor1" Runat="Server">
    <asp:FormView ID="FormView1" runat="server" CellPadding="4" DataKeyNames="IdRendicion"
        DataSourceID="SqlDataSource1" ForeColor="#333333" BackColor="#FFE0C0">
        <FooterStyle BackColor="Aquamarine" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="Cornsilk" />
        <EditItemTemplate>
            <table>
                <tr>
                    <td style="width: 3px">
                        IdRendicion:
                    </td>
                    <td>
            <asp:Label ID="IdRendicionLabel1" runat="server" Text='<%# Eval("IdRendicion") %>'>
            </asp:Label></td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        IdEmpleado:
                    </td>
                    <td>
            <asp:TextBox ID="IdEmpleadoTextBox" runat="server" Text='<%# Bind("IdEmpleado") %>'>
            </asp:TextBox></td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px; height: 24px">
                        IdTipo:
                    </td>
                    <td style="height: 24px">
                        <asp:DropDownList ID="DropDownList5" runat="server" SelectedValue='<%# Bind("IdTipo") %>'
                            Width="154px">
                            <asp:ListItem Selected="True" Value="0">Anticipo</asp:ListItem>
                            <asp:ListItem Value="1">Rendici&#243;n</asp:ListItem>
                        </asp:DropDownList></td>
                    <td style="height: 24px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        Fecha:</td>
                    <td>
            <asp:TextBox ID="FechaTextBox" runat="server" Text='<%# Bind("Fecha","{0:dd/MM/yyyy}") %>'>
            </asp:TextBox></td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        IdCC:
                    </td>
                    <td>
            <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="dbCentros" DataTextField="Descripcion"
                DataValueField="IdCC" SelectedValue='<%# Bind("IdCC") %>' Width="155px">
            </asp:DropDownList></td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        IdMoneda:</td>
                    <td>
                        <asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="dbMonedas"
                DataTextField="Descripcion" DataValueField="IdMoneda" SelectedValue='<%# Bind("IdMoneda") %>' Width="155px">
            </asp:DropDownList></td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        Importe:</td>
                    <td>
            <asp:TextBox ID="ImporteTextBox" runat="server" Text='<%# Bind("Importe") %>'>
            </asp:TextBox></td>
                    <td>
                    </td>
                </tr>
            </table>
            &nbsp;
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                Text="Actualizar">
            </asp:LinkButton>
            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                Text="Cancelar">
            </asp:LinkButton>
        </EditItemTemplate>
        <InsertItemTemplate>
            <table>
                <tr>
                    <td style="width: 3px">
                        Nro:</td>
                    <td style="width: 158px">
            </td>
                    <td style="width: 3px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        Legajo:</td>
                    <td style="width: 158px">
            <asp:TextBox ID="IdEmpleadoTextBox" runat="server" Text='<%# Bind("IdEmpleado") %>'></asp:TextBox></td>
                    <td style="width: 3px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        Tipo:</td>
                    <td style="width: 158px">
                        <asp:DropDownList ID="DropDownList4" runat="server" SelectedValue='<%# Bind("IdTipo") %>'
                            Width="155px">
                            <asp:ListItem Selected="True" Value="0">Anticipo</asp:ListItem>
                            <asp:ListItem Value="1">Rendici&#243;n</asp:ListItem>
                        </asp:DropDownList></td>
                    <td style="width: 3px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        Fecha:</td>
                    <td style="width: 158px">
            <asp:TextBox ID="FechaTextBox" runat="server" Text='<%# Bind("Fecha") %>'></asp:TextBox></td>
                    <td style="width: 3px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        IdCC:</td>
                    <td style="width: 158px">
                        <asp:DropDownList ID="IdCC" runat="server" DataSourceID="dbCentros" DataTextField="Descripcion"
                            DataValueField="IdCC" Width="156px" DataMember="DefaultView" SelectedValue='<%# Bind("IdCC") %>'>
                        </asp:DropDownList></td>
                    <td style="width: 3px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px">
                        IdMoneda:</td>
                    <td style="width: 158px">
                        <asp:DropDownList ID="DropDownList2" runat="server" DataMember="DefaultView" DataSourceID="dbMonedas"
                            DataTextField="Descripcion" DataValueField="IdMoneda" SelectedValue='<%# Bind("IdMoneda") %>' Width="155px">
                        </asp:DropDownList></td>
                    <td style="width: 3px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 3px; height: 26px">
                        Importe:</td>
                    <td style="width: 158px; height: 26px">
            <asp:TextBox ID="ImporteTextBox" runat="server" Text='<%# Bind("Importe") %>'></asp:TextBox></td>
                    <td style="width: 3px; height: 26px">
                    </td>
                </tr>
            </table>
            &nbsp;
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                Text="Insertar"></asp:LinkButton>
            <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                Text="Cancelar"></asp:LinkButton>
        </InsertItemTemplate>
        <ItemTemplate>
            IdRendicion:
            <asp:Label ID="IdRendicionLabel" runat="server" Text='<%# Eval("IdRendicion") %>'></asp:Label><br />
            IdEmpleado:
            <asp:Label ID="IdEmpleadoLabel" runat="server" Text='<%# Bind("IdEmpleado") %>'></asp:Label><br />
            IdTipo:
            <asp:Label ID="IdTipoLabel" runat="server" Text='<%# Bind("IdTipo") %>'></asp:Label><br />
            Fecha:
            <asp:Label ID="FechaLabel" runat="server" Text='<%# Bind("Fecha") %>'></asp:Label><br />
            IdCC:
            <asp:Label ID="IdCCLabel" runat="server" Text='<%# Bind("IdCC") %>'></asp:Label><br />
            IdMoneda:
            <asp:Label ID="IdMonedaLabel" runat="server" Text='<%# Bind("IdMoneda") %>'></asp:Label><br />
            Importe:
            <asp:Label ID="ImporteLabel" runat="server" Text='<%# Bind("Importe") %>'></asp:Label><br />
        </ItemTemplate>
        <PagerStyle BackColor="#CCCCCC" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#CCCCCC" />
    </asp:FormView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:demoConnectionString1 %>"
        DeleteCommand="DELETE FROM [Rendiciones] WHERE [IdRendicion] = @IdRendicion"
        InsertCommand="INSERT INTO [Rendiciones] ( [IdEmpleado], [IdTipo], [Fecha], [IdCC], [IdMoneda], [Importe]) VALUES ( @IdEmpleado, @IdTipo, @Fecha, @IdCC, @IdMoneda, @Importe)"
        SelectCommand="SELECT * FROM [Rendiciones] WHERE [IdRendicion]=@IdRendicion" UpdateCommand="UPDATE [Rendiciones] SET [IdEmpleado] = @IdEmpleado, [IdTipo] = @IdTipo, [Fecha] = @Fecha, [IdCC] = @IdCC, [IdMoneda] = @IdMoneda, [Importe] = @Importe WHERE [IdRendicion] = @IdRendicion">
        <DeleteParameters>
            <asp:Parameter Name="IdRendicion" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="IdEmpleado" Type="Int32" />
            <asp:Parameter Name="IdTipo" Type="Int32" />
            <asp:Parameter DbType="DateTime" Name="Fecha" />
            <asp:Parameter Name="IdCC" Type="Int32" />
            <asp:Parameter Name="IdMoneda" Type="Int32" />
            <asp:Parameter Name="Importe" Type="Decimal" />
            <asp:Parameter Name="IdRendicion" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="IdRendicion" Type="Int32" />
            <asp:Parameter Name="IdEmpleado" Type="Int32" />
            <asp:Parameter Name="IdTipo" Type="Int32" />
            <asp:Parameter DbType="DateTime" Name="Fecha" />
            <asp:Parameter Name="IdCC" Type="Int32" />
            <asp:Parameter Name="IdMoneda" Type="Int32" />
            <asp:Parameter Name="Importe" Type="Decimal" />
        </InsertParameters>
        <SelectParameters>
            <asp:Parameter Name="IdRendicion" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="dbCentros" runat="server" ConnectionString="<%$ ConnectionStrings:demoConnectionString1 %>"
        DataSourceMode="DataReader" DeleteCommand="DELETE FROM [CentrosCostos] WHERE [IdCC] = @IdCC"
        InsertCommand="INSERT INTO [CentrosCostos] ([IdCC], [Descripcion]) VALUES (@IdCC, @Descripcion)"
        SelectCommand="SELECT [IdCC], [Descripcion] FROM [CentrosCostos]" UpdateCommand="UPDATE [CentrosCostos] SET [Descripcion] = @Descripcion WHERE [IdCC] = @IdCC">
        <DeleteParameters>
            <asp:Parameter Name="IdCC" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Descripcion" Type="String" />
            <asp:Parameter Name="IdCC" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="IdCC" Type="Int32" />
            <asp:Parameter Name="Descripcion" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="dbMonedas" runat="server" ConnectionString="<%$ ConnectionStrings:demoConnectionString1 %>"
        DeleteCommand="DELETE FROM [Monedas] WHERE [IdMoneda] = @IdMoneda" InsertCommand="INSERT INTO [Monedas] ([IdMoneda], [Descripcion]) VALUES (@IdMoneda, @Descripcion)"
        ProviderName="<%$ ConnectionStrings:demoConnectionString1.ProviderName %>" SelectCommand="SELECT [IdMoneda], [Descripcion] FROM [Monedas]"
        UpdateCommand="UPDATE [Monedas] SET [Descripcion] = @Descripcion WHERE [IdMoneda] = @IdMoneda">
        <DeleteParameters>
            <asp:Parameter Name="IdMoneda" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Descripcion" Type="String" />
            <asp:Parameter Name="IdMoneda" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="IdMoneda" Type="Int32" />
            <asp:Parameter Name="Descripcion" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentUser" Runat="Server">
    datos del usr
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentTitle" Runat="Server">
   Rendicion de Gastos
</asp:Content>